Crate deb822_lossless

source
Expand description

Parser for deb822 style files.

This parser can be used to parse files in the deb822 format, while preserving all whitespace and comments. It is based on the rowan library, which is a lossless parser library for Rust.

Once parsed, the file can be traversed or modified, and then written back to a file.

§Example

use deb822_lossless::Deb822;
use std::str::FromStr;

let input = r#"Package: deb822-lossless
Maintainer: Jelmer Vernooij <jelmer@debian.org>
Homepage: https://github.com/jelmer/deb822-lossless
Section: rust

Package: deb822-lossless
Architecture: any
Description: Lossless parser for deb822 style files.
  This parser can be used to parse files in the deb822 format, while preserving
  all whitespace and comments. It is based on the [rowan] library, which is a
  lossless parser library for Rust.
"#;

let deb822 = Deb822::from_str(input).unwrap();
assert_eq!(deb822.paragraphs().count(), 2);
let homepage = deb822.paragraphs().nth(0).unwrap().get("Homepage");
assert_eq!(homepage.as_deref(), Some("https://github.com/jelmer/deb822-lossless"));

Re-exports§

Modules§

  • Parser for deb822 style files.
  • Lossy parser for deb822 format.

Enums§

  • The indentation to use when writing a deb822 file.

Traits§